<template>
  <div>
    <h3 ref="h3">这是Home组件下的Child子组件3</h3>
    <input type="button" @click="getParent" value="获取根组件对象">
  </div>
</template>

<script>
export default {
  data() {
    return {
    }
  },
  methods:{
    getParent(){
      // 获取根组件对象
      // console.log(this.$root);
      console.log(this.$root.msg);
      // this.$root.xxx();

      console.log( this.$refs.h3 );
    }
  }
}
</script>